<?php

/*

Use Items (useitems.php)

*/

$page_title = "Use Items";
$rank_check = 1;
include "header.inc.php";

print "$openHTML";

$find_item = fetch("SELECT * FROM usersitems2 WHERE id = '$id' AND owner = '$userid' AND game = '$game'");
$find_item2 = fetch("SELECT * FROM items2 WHERE id = '$find_item[item_id]' AND game = '$game'");

if (!$find_item[id])
{
	die(header(error("useitems.php?game=$game","The item you are trying to use does not exsist, or does not belong to you.")));
}

if (!$action)
{
	print "<br><form action=$base_url/useitems.php?game=$game&action=use&id=$id method=post><CENTER><TABLE BGCOLOR=\"$topAndBottomBG\" CELLSPACING=1 CELLPADDING=0 WIDTH=315> <TR> <TD
	COLSPAN=2 HEIGHT=30> <CENTER><FONT SIZE=\"+2\" 	COLOR=\"#FFFFFF\"><B>--$find_item2[item_name]--</B></FONT></CENTER> </TD> </TR> <TR 	BGCOLOR=\"$middleBG\"> <TD>
	<CENTER><FONT SIZE=\"-1\">\"$find_item2[item_desc]\"<BR> 	($find_item[parts_left]/$find_item2[parts] Parts)</FONT></CENTER>
	</TD> <TD BGCOLOR=\"$maincellColor\"> <P><img 	src=$base_url/images/user_images/opg_$game/items/item_$find_item2[id].gif></P> </TD>
	</TR> <TR BGCOLOR=\"$maincellColor\"> <TD COLSPAN=2 HEIGHT=30 valign=center> <CENTER><select name=item_action>";

	include strtolower($find_item2[item_type]) . "_form.act.php";

	print "
	<option value=stock>Put in Shop</option>
	<option value=safe>Put in Safety Box</option>
	<option value=gallery>Put in your Gallery</option>
	<option value=discard>Discard Item</option>
	<option value=donate>Donate Item</option>
	<option value=give_away>Give to Friend</option>
	";

	print "</SELECT> <INPUT TYPE=submit
	NAME=Submit VALUE=\"Use It!\"></CENTER> </TD> </TR> <TR BGCOLOR=\"$topAndBottomBG\"> <TD 	COLSPAN=2
	HEIGHT=30> <CENTER><FONT COLOR=\"$topAndBottomText\"><B><a href=$base_url/myitems.php?game=$game class=white>Back to My 	Items</a></B></FONT></CENTER>
</TD> </TR> </TABLE> </CENTER></form>";

}

if ($action == "use")
{
	include strtolower($item_action) . ".act.php";
}

print "$closeHTML";
?>